package net.siufung.market.base.region.enums;

import lombok.Getter;
import lombok.Setter;

/**
 * 行政区划等级
 * @author 陈建峰
 * @since 2022/5/17 6:19 下午
 */
public enum RegionLevels {

    /**
     * 省份
     */
    PROVINCES(1, "省份"),
    /**
     * 市区
     */
    CITIES(2, "市区"),
    /**
     * 县市
     */
    AREAS(3, "县市"),;

    @Getter
    @Setter
    private Integer value;
    @Getter
    @Setter
    private String desc;

    RegionLevels(Integer value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public static RegionLevels get(Integer value) {
        RegionLevels[] regionLevels = values();
        for (RegionLevels regionLevel : regionLevels) {
            if (regionLevel.getValue().equals(value)) {
                return regionLevel;
            }
        }
        return null;
    }
}
